﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Threading;

namespace VDataAdapter
{
    /// <summary>
    /// Manage all workers thread
    /// </summary>
    class WorkerManager
    {
        protected List<Worker> _workers = new List<Worker>(); // all my worker

        public WorkerManager()
        {
        }

        public void WaitForWorkerStop()
        {
            foreach (Worker worker in _workers)
            {
                worker.WaitToStop();
            }
        }

        public void ReportStart(Worker worker)
        {
            _workers.Add(worker);
        }

        public void ReportFinished(Worker worker)
        {
            _workers.Remove(worker);
        }

    }
}
